#!/bin/bash
# Copyright (c) 1998 Lawrence Livermore National Security, LLC and other
# HYPRE Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

#=============================================================================
# Sequential I/O tests
#=============================================================================

mpirun -np 1 ./struct -solver 1 -print > io.out.1P
mpirun -np 1 ./struct -solver 1 -fromfile struct.out.A > io.out.1RA
mpirun -np 1 ./struct -solver 1 -fromfile struct.out.A -rhsfromfile struct.out.b > io.out.1RAb
mpirun -np 1 ./struct -solver 1 -fromfile struct.out.A -rhsfromfile struct.out.b -x0fromfile struct.out.x0 > io.out.1RAbx

mpirun -np 1 ./struct -solver 3 -print > io.out.3P
mpirun -np 1 ./struct -solver 3 -fromfile struct.out.A > io.out.3RA
mpirun -np 1 ./struct -solver 3 -fromfile struct.out.A -rhsfromfile struct.out.b > io.out.3RAb
mpirun -np 1 ./struct -solver 3 -fromfile struct.out.A -rhsfromfile struct.out.b -x0fromfile struct.out.x0 > io.out.3RAbx

mpirun -np 1 ./struct -solver 4 -print > io.out.4P
mpirun -np 1 ./struct -solver 4 -fromfile struct.out.A > io.out.4RA
mpirun -np 1 ./struct -solver 4 -fromfile struct.out.A -rhsfromfile struct.out.b > io.out.4RAb
mpirun -np 1 ./struct -solver 4 -fromfile struct.out.A -rhsfromfile struct.out.b -x0fromfile struct.out.x0 > io.out.4RAbx

#=============================================================================
# Parallel I/O tests
#=============================================================================

mpirun -np 8 ./struct -solver 1 -print > io.out.101P
mpirun -np 8 ./struct -solver 1 -fromfile struct.out.A -rhsfromfile struct.out.b > io.out.101RAb

mpirun -np 8 ./struct -solver 3 -print > io.out.103P
mpirun -np 8 ./struct -solver 3 -fromfile struct.out.A -rhsfromfile struct.out.b > io.out.103RAb

mpirun -np 8 ./struct -solver 4 -print > io.out.104P
mpirun -np 8 ./struct -solver 4 -fromfile struct.out.A -rhsfromfile struct.out.b > io.out.104RAb

